package com.enlf.controller.admin;

import com.enlf.dto.R;
import com.enlf.dto.UserDTO;
import com.enlf.entity.MenuPermission;
import com.enlf.service.IMenuPermissionService;
import com.enlf.utils.UserHolder;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * _*_ coding : utf-8 _*_
 *
 * @Time : 2024/3/18 22:19
 * @Author : 计201任思伟
 * @File : AdminMenuPermissionController
 * @Project : enjoy-life
 */
@Slf4j
@RestController
@RequestMapping("/admin/menu")
public class AdminMenuPermissionController {
    @Resource
    private IMenuPermissionService menuPermissionService;

    /**
     * 菜单列表
     * @return
     */
    @GetMapping("/list")
    public R queryMenuList() {
        // 获取登录用户
        UserDTO user = UserHolder.getUser();
        List<String> menuList =
                menuPermissionService.getMenuPermissionByUserId(user.getId());
        return R.OK(menuList);
    }


}
